package org.dtrd.modules.questionnaire.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.questionnaire.entity.bean.QuestionnaireDataDetail;


/**
 * <p>
 * 
 * </p>
 *
 * @author xiao
 * @since 2022-06-16
 */
@Data
@TableName("dtrd_ent_rd_questionnaire_data")
public class DtrdEntRdQuestionnaireData {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    @TableField("question_id")
    private Integer questionId;

    @TableField("patient_id")
    private Integer patientId;

    @TableField("answer")
    private String answer;

    @TableField("score")
    private Float score;

    @TableField("question_type")
    private String questionType;

    @TableField("create_time")
    private Date createTime;

    public DtrdEntRdQuestionnaireData init() {
        createTime = new Date();
        return this;
    }

    public DtrdEntRdQuestionnaireData parseFromDto(QuestionnaireDataDetail dto) {
        dataId = dto.getDataId();
        questionId = dto.getQuestionId();
        patientId = dto.getPatientId();
        answer = dto.getAnswer();
        score = dto.getScore();
        questionType = dto.getQuestionType();
        return this;
    }


}
